<!doctype html>
<html lang="zh">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  <link rel="icon" href="../dist/img/favicon-32x32.png" sizes="32x32" type="image/png">
  <link rel="icon" href="../dist/img/favicon-16x16.png" sizes="16x16" type="image/png">
  <meta name="keywords" content="响应式后台模板,开源免费后台模板,Bootstrap5后台管理系统模板">
  <meta name="description" content="bootstrap-admin基于bootstrap5的免费开源的响应式后台管理模板">
  <meta name="author" content="ajiho">
  <link rel="stylesheet" href="../lib/bootstrap-icons/font/bootstrap-icons.min.css">
  <link rel="stylesheet" href="../lib/bootstrap/dist/css/bootstrap.min.css">
  <link rel="stylesheet" href="../dist/css/bootstrap-admin.min.css">
  <title>bootstrap-admin开源免费响应式后台管理系统模板</title>
</head>
<body class="bg-body-tertiary py-3">
<div class="container-fluid">
  <!--  正文内容放置在此处  -->

  <!--  为了美观,建议大家都把新内容都放card组件里面  -->
  <div class="card border-0 shadow-sm">
    <div class="card-body">
      <form id="form">
        <div class="row mb-3">
          <label for="subject_id" class="col-sm-2 col-form-label text-sm-end">学科ID</label>
          <div class="col-sm-10">
            <input type="text" class="form-control" id="subject_id" name="subject_id" value="">
          </div>
        </div>
        <div class="row mb-3">
          <label for="subject_name" class="col-sm-2 col-form-label text-sm-end">学科名称</label>
          <div class="col-sm-10">
            <input type="text" class="form-control" id="subject_name" name="subject_name" value="">
          </div>
        </div>
        <div class="row mb-3">
          <label for="subject_level" class="col-sm-2 col-form-label text-sm-end">学科等级</label>
          <div class="col-sm-10">
            <select class="form-select" id="subject_level" name="subject_level">
              <option value="1">一级学科</option>
              <option value="2">二级学科</option>
              <option value="3">三级学科</option>
            </select>
          </div>
        </div>
        <div class="row mb-3">
          <label for="parent_subject" class="col-sm-2 col-form-label text-sm-end">上级学科</label>
          <div class="col-sm-10">
            <input type="text" class="form-control" id="subject_name" name="subject_name" value="">
          </div>
        </div>
        <div class="row mb-3">
          <label for="subject_description" class="col-sm-2 col-form-label text-sm-end">学科概述</label>
          <div class="col-sm-10">
            <textarea class="form-control" id="subject_description" name="subject_description" rows="3"></textarea>
          </div>
        </div>
        <div class="row mb-3">
          <label for="subject_type" class="col-sm-2 col-form-label text-sm-end">学科类型</label>
          <div class="col-sm-10">
            <input type="text" class="form-control" id="subject_name" name="subject_name" value="">
          </div>
        </div>
        <div class="row mb-3">
          <div class="col-sm-10 offset-sm-2">
            <button type="submit" class="btn btn-primary">修改</button>
          </div>
        </div>
      </form>
    </div>
  </div>

  <!--回到顶部开始-->
  <a href="javaScript:" class="bsa-back-to-top"><i class='bi bi-arrow-up-short'></i></a>
  <!--回到顶部结束-->

</div>


<script src="../lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="../lib/jquery/dist/jquery.min.js"></script>
<script src="../lib/formvalidation/js/formValidation.js"></script>
<script src="../lib/formvalidation/js/framework/bootstrap.js"></script>
<script src="../lib/formvalidation/js/language/zh_CN.js"></script>
<script src="../dist/js/bootstrap-admin.min.js"></script>
<script src="../dist/js/app.js"></script>
<!--假数据模拟,生产环境中请直接删除该js-->
<script src="../dist/js/bootstrap-admin.mock.js"></script>
<script>

  $(document).ready(function (e) {
    $("#form").formValidation({
      //验证字段
      fields: {
        name: {
          validators: {
            notEmpty: true
          }
        },
        //...
      }
    }).on('success.form.fv', function (e) {
      //阻止表单提交
      e.preventDefault();
      //得到表单对象
      let $form = $(e.target);
      let data = $form.serialize();


      //得到序列化数据
      $.ajax({
        url: "/nodeadd",
        method: 'post',
        data: data,
        success: function (res) {
          //添加成功
          $.toasts({
            type: 'success',
            content: '修改成功',
            delay: 1000,
            autohide: true,
            onHidden: function () {
              parent.editRoleModal.setData(true);
              parent.editRoleModal.close();
            }
          })
        }
      })
    });
  })
</script>
</body>
</html>
